Text to Image API
Text to Image API Documentation
Version: 1.2.2
Paths
Healthcheck API
/text-to-image/api/v1/healthz/
- Method: GET
- Summary: Health Check
- Description: Return Health Status.
- Responses:
- 200:
- Description: Successful Response
- Content-Type: application/json
- 200:
Text Validation API
/text-to-image/api/v1/text_validation
- Method: POST
- Summary: Validate the provided input text.
- Description: The provided input text is validated to ensure it is suitable for generating an image. It checks if the input text can be interpreted and processed effectively to produce a corresponding image.
Request Payload:
Type | Parameter | Description | Data Type | Is Optional |
---|---|---|---|---|
Form Data | input_type | Validates the Input text | String | No |
Sample Code :
import requests
url = "https://api-genai-dev.learningmate.co/text-to-image/api/v1/text_validation"
token = "your_token_here"
headers = {
"accept": "application/json",
"Authorization": f"Bearer {token}",
"Content-Type": "application/x-www-form-urlencoded",
}
data = {
"input_text": """A paper craft art depicting a girl giving her cat a gentle hug. Both sit amidst potted plants, with the cat purring contentedly while the girl smiles. The scene is adorned with handcrafted paper flowers and leaves.""",
}
response = requests.post(url, headers=headers, data=data)
Example Response:
{
"status_code": 200,
"message": "SUCCESS::Text Validation generated successfully",
"input_text": "Your input text result will appear here"
}
Responses:
Status Code | Description | Content-Type |
---|---|---|
200 | Successful Response | application/json |
201 | Successful Creation | application/json |
400 | Bad Request | application/json |
422 | Unprocessable Entity | application/json |
500 | Internal Server Error | application/json |
Text to Image Generation API
/text-to-image/api/v1/text_to_image
- Method: POST
- Summary: Generate image for the provided input text
- Description: The generated image can be customized by specifying the number of images to be generated, and the aspect ratio of the images.
Request Payload:
Type | Parameter | Description | Data Type | Is Optional |
---|---|---|---|---|
Form Data | user_model_selection | AI model selection (dalle-3) | String | No |
Form Data | input_type | Input text | String | No |
Form Data | number_of_images | Number of images to be generated | String | No |
Form Data | aspect_ratio | Aspect Ratio of images | String | No |
Sample Code :
import requests
url = "https://api-genai-dev.learningmate.co/text-to-image/api/v1/text_to_image"
token = "your_token_here"
headers = {
"accept": "application/json",
"Authorization": f"Bearer {token}",
"Content-Type": "application/x-www-form-urlencoded",
}
data = {
"user_model_selection": "dall-e-3",
"input_text": """A paper craft art depicting a girl giving her cat a gentle hug. Both sit amidst potted plants, with the cat purring contentedly while the girl smiles. The scene is adorned with handcrafted paper flowers and leaves.""",
"number_of_images": "3",
"aspect_ratio": "1:1",
}
response = requests.post(url, headers=headers, data=data)
Example Response:
{
"status_code": 200,
"message": "SUCCESS::Text to Image generated successfully",
"images_created": {
"image_url_1": "Your image_url will appear here",
"image_url_2": "Your image_url will appear here",
"image_url_3": "Your image_url will appear here"
}
}
Responses:
Status Code | Description | Content-Type |
---|---|---|
200 | Successful Response | application/json |
201 | Successful Creation | application/json |
400 | Bad Request | application/json |
422 | Unprocessable Entity | application/json |
500 | Internal Server Error | application/json |